package com.zpark.service.impl;

import com.zpark.mapper.IUserMapper;
import com.zpark.pojo.Empty;
import com.zpark.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xiaoyu
 * @version 1.0 2022/9/8
 */
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private IUserMapper userMapper;

    @Override
    public Integer addEmpty(Empty empty) {
        return userMapper.insertEmpty(empty);
    }

    @Override
    public Integer removeEmptyById(Integer id) {
        return userMapper.deleteEmptyById(id);
    }

    @Override
    public Integer changeEmptyById(Empty empty) {
        return userMapper.updateEmptyById(empty);
    }

    @Override
    public List<Empty> findAll() {
        return userMapper.selectAll();
    }

    @Override
    public List<Empty> findByUsername(String username) {
        return userMapper.selectByUsername(username);
    }

    @Override
    public List<Empty> findByPage(Integer pageNum, Integer pageSize) {
        return userMapper.selectByPage(pageSize*(pageNum - 1), pageSize);
    }
}
